From: Pascal Nowack Date: Sat, 22 Sep 2018 15:43:22 +0000 (+0200) Subject: history: Stop saving non-consecutive duplicate entries X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~929^2^2~22 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=2b1f664aed5133f58112d4170b6190baec5a18a0;p=gnome-shell.git history: Stop saving non-consecutive duplicate entries Whenever a command runs in the run dialog, it will be added to the history unless it is already the last entry. This does not apply for entries that are not consecutive, which can result in long chains of commands which alternate, e.g. lg, r, lg, r, lg, r. Not only is this wasteful in terms of space, but also inconsistent with how history works elsewhere, e.g. in the shell. Therefore, remove entries in the history that are equal to the one that will be added to the end of of the history when the entry already exists. https://gitlab.gnome.org/GNOME/gnome-shell/issues/524 --- diff --git a/js/misc/history.js b/js/misc/history.js index 693e6de1c..f1d037018 100644 --- a/js/misc/history.js +++ b/js/misc/history.js @@ -76,6 +76,7 @@ var HistoryManager = new Lang.Class({ if (this._history.length == 0 || this._history[this._history.length - 1] != input) { + this._history = this._history.filter(entry => entry != input); this._history.push(input); this._save(); }